//
// Created by win10 on 24-12-12.
//

#include <stdio.h>

#define NOT_FOUND -1

int search(int a[], int n, int target);

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    int a1[n], a2[m];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a1[i]);
    }
    for (int i = 0; i < m; i++) {
        scanf("%d", &a2[i]);
    }
    for (int i = 0; i < m - 1; i++) {
        int result = search(a1, n, a2[i]);
        if (result == NOT_FOUND) {
            printf("-1 ");
        } else {
            printf("%d ", result);
        }
    }
    int result = search(a1, n, a2[m - 1]);
    if (result == NOT_FOUND) {
        printf("-1");
    } else {
        printf("%d", result);
    }
    return 0;
}

int search(int a[], int n, int target) {
    int low = 0, high = n - 1, mid;
    while (low <= high) {
        mid = (low + high) / 2;
        if (a[mid] == target) {
            return mid;
        } else if (a[mid] > target) {
            high = mid - 1;
        } else {
            low = mid + 1;
        }
    }
    return NOT_FOUND;
}